using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Decisions.HL7.Message;
using DecisionsFramework;

namespace Decisions.HL7.Message
{
    public class FillerstatuscodesAttribute:RuleAttribute
    {
        private Dictionary<HL7Version, string[]> validVersionCodes = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, string[]> validVersionDescriptions = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, HL7TableType> tableVersionTypes = new Dictionary<HL7Version, HL7TableType>();

        public FillerstatuscodesAttribute()
        {
            // init the values for table version types
						tableVersionTypes[HL7Version.v23] = HL7TableType.User;
						tableVersionTypes[HL7Version.v231] = HL7TableType.User;
						tableVersionTypes[HL7Version.v24] = HL7TableType.User;
						tableVersionTypes[HL7Version.v25] = HL7TableType.User;
						tableVersionTypes[HL7Version.v251] = HL7TableType.User;
						tableVersionTypes[HL7Version.v26] = HL7TableType.User;
						tableVersionTypes[HL7Version.v27] = HL7TableType.User;
			
            
			// init the values for version codes
						validVersionCodes[HL7Version.v23] = new string[]{"BLOCKED","BOOKED","CANCELLED","COMPLETE","DC","DELETED","OVERBOOK","PENDING","STARTED","WAITLIST"};
						validVersionCodes[HL7Version.v231] = new string[]{"Pending","Waitlist","Booked","Started","Complete","Cancelled","Dc","Deleted","Blocked","Overbook"};
						validVersionCodes[HL7Version.v24] = new string[]{"Pending","Waitlist","Booked","Started","Complete","Cancelled","Dc","Deleted","Blocked","Overbook"};
						validVersionCodes[HL7Version.v25] = new string[]{"Pending","Waitlist","Booked","Started","Complete","Cancelled","Dc","Deleted","Blocked","Overbook","Noshow"};
						validVersionCodes[HL7Version.v251] = new string[]{"Pending","Waitlist","Booked","Started","Complete","Cancelled","Dc","Deleted","Blocked","Overbook","Noshow"};
						validVersionCodes[HL7Version.v26] = new string[]{"Pending","Waitlist","Booked","Started","Complete","Cancelled","Dc","Deleted","Blocked","Overbook","Noshow"};
						validVersionCodes[HL7Version.v27] = new string[]{"Pending","Waitlist","Booked","Started","Complete","Cancelled","Dc","Deleted","Blocked","Overbook","Noshow"};
			
			// init the values for version descriptions
						validVersionDescriptions[HL7Version.v23] = new string[]{"The indicated time slot(s) is(are) blocked.  Not used in the AIS, AIG, AIL, AIP segments.","The indicated appointment is booked","The indicated appointment was stopped from occurring (cancelled prior to starting)","The indicated appointment has completed normally (was not discontinued, canceled, or deleted)","The indicated appointment was discontinued (DC’ed while in progress, discontinued parent appointment, or discontinued child appointment)","The indicated appointment was deleted from the filler application","The appointment has been confirmed; however it is confirmed in an overbooked state","Appointment has not yet been confirmed","The indicated appointment has begun and is currently in progress","Appointment has been placed on a waiting list for a paricular slot, or set of slots"};
						validVersionDescriptions[HL7Version.v231] = new string[]{"Appointment has not yet been confirmed","Appointment has been placed on a waiting list for a particular slot, or set of slots","The indicated appointment is booked","The indicated appointment has begun and is currently in progress","The indicated appointment has completed normally (was not discontinued, canceled, or deleted)","T7he indicated appointment was stopped from occurring (canceled prior to starting)","The indicated appointment was discontinued (DC’ed while in progress, discontinued parent appointment, or discontinued child appointment)","The indicated appointment was deleted from the filler application","The indicated time slot(s) is(are) blocked","The appointment has been confirmed; however it is confirmed in an overbooked state"};
						validVersionDescriptions[HL7Version.v24] = new string[]{"Appointment has not yet been confirmed","Appointment has been placed on a waiting list for a particular slot, or set of slots","The indicated appointment is booked","The indicated appointment has begun and is currently in progress","The indicated appointment has completed normally (was not discontinued, canceled, or deleted)","The indicated appointment was stopped from occurring (canceled prior to starting)","The indicated appointment was discontinued (DC'ed while in progress, discontinued parent appointment, or discontinued child appointment)","The indicated appointment was deleted from the filler application","The indicated time slot(s) is(are) blocked","The appointment has been confirmed; however it is confirmed in an overbooked state"};
						validVersionDescriptions[HL7Version.v25] = new string[]{"Appointment has not yet been confirmed","Appointment has been placed on a waiting list for a particular slot, or set of slots","The indicated appointment is booked","The indicated appointment has begun and is currently in progress","The indicated appointment has completed normally (was not discontinued, canceled, or deleted)","The indicated appointment was stopped from occurring (canceled prior to starting)","The indicated appointment was discontinued (DC'ed while in progress, discontinued parent appointment, or discontinued child appointment)","The indicated appointment was deleted from the filler application","The indicated time slot(s) is(are) blocked","The appointment has been confirmed; however it is confirmed in an overbooked state","The patient did not show up for the appointment"};
						validVersionDescriptions[HL7Version.v251] = new string[]{"Appointment has not yet been confirmed","Appointment has been placed on a waiting list for a particular slot, or set of slots","The indicated appointment is booked","The indicated appointment has begun and is currently in progress","The indicated appointment has completed normally (was not discontinued, canceled, or deleted)","The indicated appointment was stopped from occurring (canceled prior to starting)","The indicated appointment was discontinued (DC'ed while in progress, discontinued parent appointment, or discontinued child appointment)","The indicated appointment was deleted from the filler application","The indicated time slot(s) is(are) blocked","The appointment has been confirmed; however it is confirmed in an overbooked state","The patient did not show up for the appointment"};
						validVersionDescriptions[HL7Version.v26] = new string[]{"Appointment has not yet been confirmed","Appointment has been placed on a waiting list for a particular slot, or set of slots","The indicated appointment is booked","The indicated appointment has begun and is currently in progress","The indicated appointment has completed normally (was not discontinued, canceled, or deleted)","The indicated appointment was stopped from occurring (canceled prior to starting)","The indicated appointment was discontinued (DC'ed while in progress, discontinued parent appointment, or discontinued child appointment)","The indicated appointment was deleted from the filler application","The indicated time slot(s) is(are) blocked","The appointment has been confirmed; however it is confirmed in an overbooked state","The patient did not show up for the appointment"};
						validVersionDescriptions[HL7Version.v27] = new string[]{"Appointment has not yet been confirmed","Appointment has been placed on a waiting list for a particular slot, or set of slots","The indicated appointment is booked","The indicated appointment has begun and is currently in progress","The indicated appointment has completed normally (was not discontinued, canceled, or deleted)","The indicated appointment was stopped from occurring (canceled prior to starting)","The indicated appointment was discontinued (DC'ed while in progress, discontinued parent appointment, or discontinued child appointment)","The indicated appointment was deleted from the filler application","The indicated time slot(s) is(are) blocked","The appointment has been confirmed; however it is confirmed in an overbooked state","The patient did not show up for the appointment"};
			            

        }

        
        public override ValidationIssue[] RunRule(string name, object owningObject, object value)
        {
            //todo: check if the value is valid in the current version
            //if the value is not valid in the current version, add it as a validation issue


            return new ValidationIssue[0];
        }
    }
}
